package com.linran.webjsonrsp.bean;

import lombok.Getter;
import lombok.ToString;
import org.springframework.http.HttpStatus;

/**
 * 状态码枚举类
 *
 * @author lin
 * @date 2020-05-05 15:27
 */
@ToString
@Getter
public enum ResultStatus {
    SUCCESS(HttpStatus.OK, 200, "OK"),
    BAD_REQUEST(HttpStatus.BAD_REQUEST, 400, "bad request"),
    INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, 500, "Internal Server Error");

    /**
     * httpStatus状态码
     */
    private HttpStatus status;
    /**
     * 业务状态码
     */
    private Integer code;
    /**
     * 返回信息
     */
    private String message;

    ResultStatus(HttpStatus status, Integer code, String message) {
        this.status = status;
        this.code = code;
        this.message = message;
    }

    public HttpStatus getHttpStatus() {
        return this.status;
    }
}
